﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VietThinks.Model;

namespace VietThinks.Mapping.Maps
{
    public class RightMap : DomainEntityMap<Right>
    {
        public RightMap()
        {
            Schema("Admin");
            Table("Right");
            Map(m => m.Code);
            Map(m => m.Name);
            Map(m => m.Actived);
            Map(m => m.CreatedDate);
            Map(m => m.ModifiedDate);
            //HasManyToMany(m => m.Roles)
            //    .Schema("Admin")
            //    .Table("RightInRole")
            //    .ChildKeyColumn("RoleId")
            //    .ParentKeyColumn("RightId")
            //    .BatchSize(10);
            HasMany(m => m.Roles)
               .KeyColumn("RightId")
               .Inverse()
               .Cascade.AllDeleteOrphan()
              ;

            //HasMany(m => m.Roles)
            //    .KeyColumn("RoleId")
            //    .Access.CamelCaseField()
            //    .Cascade.AllDeleteOrphan();
        }
    }
}
